﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ArticleSort.aspx.cs" Inherits="RichECMS.ServerPages.Section.ArticleSort" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>河南锐之旗CMS网站内容管理平台系统</title>
    <meta name="Keywords" content="河南锐之旗CMS网站内容管理平台系统" />
    <meta name="Description" content="河南锐之旗CMS网站内容管理平台系统" />
    <meta name="auther" content="河南锐之旗信息技术有限公司|河南企汇网信息技术有限公司" />
    <link href="../../sysCommon/sysStyle/Pages.css" type="text/css" rel="stylesheet" />
    <link href="../../sysCommon/sysStyle/style.css" type="text/css" rel="stylesheet" />
    <script src="../../sysCommon/sysScripts/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#btnup").click(function () {
                var optionsize = $("#lst option").length;
                var optionarray = $("#lst option");
                var first;
                var otheroptionstring
                for (var i = 0; i < optionsize; i++) {
                    if (optionarray.eq(i).val() == $('#lst option:selected').val()) {
                        first = i;
                    }
                }

                if (first == 0) {
                    alert("已经到达排序顶部");
                    return;
                }

                $('#lst').html("");
                $("#Hiddensort").val("");
                var finalsort = "";
                for (var i = 0; i < optionsize; i++) {
                    if (i == first - 1) {
                        $('#lst').append(optionarray.eq(first));
                        if (i == 0) {
                            finalsort = optionarray.eq(first).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(first).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(first).val() + ",";
                        }
                    }
                    else if (i == first) {
                        $('#lst').append(optionarray.eq(first - 1));
                        if (i == 0) {
                            finalsort = optionarray.eq(first - 1).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(first - 1).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(first - 1).val() + ",";
                        }
                    }
                    else {
                        $('#lst').append(optionarray.eq(i));
                        if (i == 0) {
                            finalsort = optionarray.eq(i).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(i).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(i).val() + ",";
                        }
                    }
                    $("#Hiddensort").val(finalsort);
                }
            })
            $("#btndown").click(function () {
                var optionsize = $("#lst option").length;
                var optionarray = $("#lst option");
                var first;
                var otheroptionstring
                for (var i = 0; i < optionsize; i++) {
                    if (optionarray.eq(i).val() == $('#lst option:selected').val()) {
                        first = i;
                    }
                }

                if (first == optionsize - 1) {
                    alert("已经到达排序底部");
                    return;
                }

                $("#Hiddensort").val("");
                var finalsort = "";
                for (var i = 0; i < optionsize; i++) {
                    if (i == first) {
                        $('#lst').append(optionarray.eq(first + 1));
                        if (i == 0) {
                            finalsort = optionarray.eq(first + 1).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(first + 1).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(first + 1).val() + ",";
                        }
                    }
                    else if (i == first + 1) {
                        $('#lst').append(optionarray.eq(first));
                        if (i == 0) {
                            finalsort = optionarray.eq(first).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(first).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(first).val() + ",";
                        }
                    }
                    else {
                        $('#lst').append(optionarray.eq(i));
                        if (i == 0) {
                            finalsort = optionarray.eq(i).val() + ",";
                        } else if (i == optionsize - 1) {
                            finalsort = finalsort + optionarray.eq(i).val();
                        } else {
                            finalsort = finalsort + optionarray.eq(i).val() + ",";
                        }
                    }
                    $("#Hiddensort").val(finalsort);
                }
            })
        })
    </script>
    <script src="../../sysCommon/sysScripts/parent1.js" type="text/javascript"></script>
    <script src="../../sysCommon/sysScripts/commompage.js" type="text/javascript"></script>
    <style type="text/css">
        .imgeditarea
        {
            display: none;
        }
        .style1
        {
            width: 543px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div class="main_body">
        <!--右侧-->
        <div class="right_body">
            <div class="right_top">
                <a href="###">CMS内容管理平台</a>><a href="#">首页</a><asp:Literal ID="LitPaagePath" runat="server"></asp:Literal>
            </div>
            <div class="title">
                <div class="information">
                    栏目名称：<font style="color: #6a544a;"><asp:Literal ID="LitPageName" runat="server"></asp:Literal></font></div>
            </div>
            <table border="0" align="left" cellpadding="0" cellspacing="0" style="width: 100%"
                class="edit">
                <tr>
                    <td align="left" valign="middle" height="36">
                        <div class="edit_title">
                            <div class="tit_name">
                                文章排序</div>
                            <div class="menu">
                                <a href="###">
                                    <img src="../../sysCommon/sysImages/systerm/menu_up.gif" alt="向上关闭" width="36" height="36" /></a>
                                <!--<img src="../../sysCommon/sysImages/systerm/menu_down.gif" width="36" height="36" />-->
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="width: auto; padding-top: 10px; padding-left: 20px; padding-bottom: 10px;">
                        <table border="0" align="left" cellpadding="0" cellspacing="0" style="width: 100%">
                            <tr>
                                <td align="left" valign="middle" style="padding-top: 5px;">
                                    <table align="left" width="100%">
                                        <tr>
                                            <td class="style1">
                                                <asp:ListBox ID="lst" runat="server" Height="285px" Width="100%"></asp:ListBox>
                                            </td>
                                            <td>
                                                <table align="left">
                                                    <tr>
                                                        <td>
                                                            <a href="###" id="btnup">
                                                                <img src="/sysCommon/sysImages/art_top.png" /></a>
                                                            <%--  <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/sysCommon/sysImages/art_top.png"
                                                                OnClick="ImageButton1_Click" />--%>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <a href="###" id="btndown">
                                                                <img src="/sysCommon/sysImages/art_down.png" /></a>
                                                            <%-- <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/sysCommon/sysImages/art_down.png"
                                                                OnClick="ImageButton2_Click" />--%>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td height="40" valign="middle" style="padding-left: 20px;">
                        <table width="365" border="0" align="left" cellpadding="0" cellspacing="0" height="40">
                            <tr>
                                <td align="left" valign="middle" width="65">
                                    &nbsp;
                                </td>
                                <td align="left" valign="middle" width="100">
                                    <asp:ImageButton ID="ImageButtonOk" ImageUrl="../../sysCommon/sysImages/systerm/button_5.jpg"
                                        runat="server" AlternateText="提交信息" Width="87" Height="27" ToolTip="提交信息" OnClick="SubmitBtnHander" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <asp:HiddenField ID="Hiddensort" runat="server" />
    </form>
</body>
</html>